// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   Email.java

package include.nseer_cookie;

import java.util.Date;
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;

// Referenced classes of package include.nseer_cookie:
//			SmtpHost

public class Email
{

	public Email()
	{
	}

	public void send(String emailbox[], String smtp, String from, String passwd, String subject, String content)
	{
		try
		{
			Properties props = new Properties();
			String sh[] = SmtpHost.getContent("ondemand1");
			props.put("mail.smtp.host", sh[0]);
			props.put("mail.smtp.auth", "true");
			Session s = Session.getDefaultInstance(props, null);
			s.setDebug(true);
			MimeMessage msg = new MimeMessage(s);
			InternetAddress fromAddress = new InternetAddress(sh[1]);
			msg.setFrom(fromAddress);
			for (int i = 0; i < emailbox.length; i++)
			{
				InternetAddress toAddress = new InternetAddress(emailbox[i]);
				if (emailbox.length == 1)
					msg.addRecipient(javax.mail.Message.RecipientType.TO, toAddress);
				else
					msg.addRecipient(javax.mail.Message.RecipientType.BCC, toAddress);
			}

			msg.setSubject(subject);
			BodyPart bp = new MimeBodyPart();
			bp.setContent(content, "text/html;charset=UTF-8");
			Multipart mp = new MimeMultipart();
			mp.addBodyPart(bp);
			msg.setContent(mp);
			msg.setSentDate(new Date());
			msg.saveChanges();
			Transport transport = s.getTransport("smtp");
			transport.connect(sh[0], sh[1], sh[2]);
			transport.sendMessage(msg, msg.getAllRecipients());
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
